$(()=>{
    $("input[name='chinaSave']").on('blur',function(){
          var srtId = $(this).parent().next().children().children().eq(0).attr("srtId");
          var catalogId = $(this).parent().next().children().children().eq(0).attr("catalogId");
          var orderNum = $(this).parent().parent().children().eq(0).children().first().val();

          var startTime = $(this).parent().parent().children().eq(1).children().first().val();
          var endTime = $(this).parent().parent().children().eq(1).children().last().val();

          var chContent = $(this).parent().parent().children().eq(2).children().first().val();
          var enContent = $(this).parent().parent().children().eq(2).children().last().val();
          var rules = [{id: srtId, catalog: catalogId,startTime: startTime ,endTime: endTime, orderNum: orderNum
          , enContent: enContent, chContent: chContent}];
          var span =  $(this).parent().next().children().children().eq(1);
          $.ajax({
              type: "PUT",
              contentType: "application/json;charset=utf-8",
              dataType: "json",
              url: "/srtContent/edit/" + srtId,
              data: JSON.stringify(rules),
              async: false,
              success: function (data) {
                    $(span).html("保存成功");
                    setTimeout(function(){$(span).html("")},2000);
              }
          });
    });
    $('.saveBtn').on('click', function () {
          var srtId = $(this).attr("srtId");
          var catalogId = $(this).attr("catalogId");
          var orderNum = $(this).parent().parent().parent().children().eq(0).children().first().val();

          var startTime = $(this).parent().parent().parent().children().eq(1).children().first().val();
          var endTime = $(this).parent().parent().parent().children().eq(1).children().last().val();

          var chContent = $(this).parent().parent().parent().children().eq(2).children().first().val();
          var enContent = $(this).parent().parent().parent().children().eq(2).children().last().val();
          var rules = [{id: srtId, catalog: catalogId,startTime: startTime ,endTime: endTime, orderNum: orderNum
          , enContent: enContent, chContent: chContent}];
          $.ajax({
              type: "PUT",
              contentType: "application/json;charset=utf-8",
              dataType: "json",
              url: "/srtContent/edit/" + srtId,
              data: JSON.stringify(rules),
              async: false,
              success: function (data) {
                $(span).html("保存成功");
                setTimeout(function(){$(span).html("")},2000);
              }
          });
      });
})
